using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace Daniel.Core.Models.Mapping
{
    public class ProductReviewHelpfulnessMap : EntityTypeConfiguration<ProductReviewHelpfulness>
    {
        public ProductReviewHelpfulnessMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            // Table & Column Mappings
            this.ToTable("ProductReviewHelpfulness");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.ProductReviewId).HasColumnName("ProductReviewId");
            this.Property(t => t.WasHelpful).HasColumnName("WasHelpful");
            this.Property(t => t.CustomerId).HasColumnName("CustomerId");

            // Relationships
            this.HasRequired(t => t.ProductReview)
                .WithMany(t => t.ProductReviewHelpfulnesses)
                .HasForeignKey(d => d.ProductReviewId);

        }
    }
}
